<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/admin_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!--semantic-ui的cdn引入-->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
</head>
<body>

<!--导航部分-->
<nav th:replace="admin/admin_fragments ::menu" class="ui inverted attached segment">
    <div class="container">
        <div class="ui inverted stackable menu">

            <h2 class="ui teal header item m-padding-up-dowm-min">后台管理</h2>

            <a href="" class="item"><i class="home icon"></i>博客</a>

            <a href="" class="item"><i class="edit icon"></i>分类</a>

            <a href="" class="item"><i class="tags icon"></i>标签</a>

            <!--头像栏-->
            <div class="right menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <i class="user icon"></i>
                        lgb
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</nav>
<!--二级导航-->
<div th:replace="admin/admin_fragments ::secondary_menu(0)" class="ui attached pointing menu">
    <div class="container">
        <a href="#" class="item">发布</a>
        <a href="#" class="item">列表</a>
    </div>
</div>


<!--中间内容-->
<div class="m-footer-padding-up-dowm-min">
    <div class="ui container">
        <div class="ui success message">
            <h2>HI LGB</h2>
            <pi>你好，欢迎登录</pi>
        </div>

        <div class="ui success message">
            <br>
            <!--有留言时-->
            <div th:if="${#arrays.length(messages)} > 0">
                您有<span th:text="${#arrays.length(messages)}">x</span>条新的留言,如下
            </div>
            <!--没有留言时-->
            <div th:if="${#arrays.length(messages)} == 0">
                当前没有新的留言
            </div>
                <ul class="ui divided list">
                    <!-- 留言区 -->
                    <div class="item" th:each="message : ${messages}">
                        <button class="right floated compact ui basic button">
                            <a th:href="@{/delete_message/{id}(id = ${message.id})}">已阅</a>
                        </button>
                        <div class="content aligned">
                            <div class="header" th:text="${message.content}">留言1</div>
                        </div>
                    </div>
                </ul>
            </div>

        <div class="ui success message">
            <form class="ui form" th:action="@{/admin/save_announcement}" method="post">
                <div class="field">
                    <textarea placeholder="公共内容...." name="content" th:text="${announcement.content}"></textarea>
                </div>
                <div style="display: flex !important;justify-content: center !important;">
                    <button class="ui submit button basic center aligned" type="submit">提交</button>
                </div>
                <!--表单验证信息 默认在ui error message里提示-->
                <div class="ui error message"></div>
            </form>
        </div>

    </div>
</div>

<br>
<br>
<br>
<br>

<!--底部footer-->
<footer th:replace="admin/admin_fragments ::footer" class="ui inverted center aligned vertical segment m-footer-padding-up-dowm-min">
    <div class="container">
        <!--grid:横向分成16份,底下的元素为3+3+3+7-->
        <div class="ui divided  inverted grid">

            <div class="three wide column">
                <h4 class="ui inverted header">二维码</h4>
                <img src="..\..\static\images\二维码.png"  style="width: 80px;">
            </div>

            <div class="three wide column">
                <h4 class="ui inverted header">个人博客</h4>
                <div class="ui inverted list link">
                    <a href="#" class="item">1.0 xxx</a>
                    <a href="#" class="item">2.0 xxx</a>
                    <a href="#" class="item">3.0 xxx</a>
                </div>
            </div>

            <div class="three wide column">
                <h4 class="ui inverted header">联系我</h4>
                <div class="ui inverted list link">
                    <a href="#" class="item">微信:13776710591</a>
                    <a href="#" class="item">QQ:2899847639</a>
                    <a href="#" class="item">GitHub:xxxxxxx</a>
                </div>
            </div>

            <div class="seven wide column">
                <h4 class="ui inverted header">个人博客</h4>
                <p>
                    emmm,你要说点什么
                </p>
            </div>
        </div>

        <!--一条线-->
        <div class="ui inverted section divider"></div>
        <p>emmm,你要说点什么</p>

    </div>
</footer>

<!--引入jquery和semantic-ui-->
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>
<script>
    //下拉的使用
    $('.ui.dropdown').dropdown({
        on:'hover'
    })

    //表单验证
    $('.ui.form').form({
        fields: {
            //content部分
            content: {
                //和name保存一致
                identifier: 'content',
                //规则
                rules: [{
                    type: 'empty',
                    prompt: '请输入公告内容'
                }]
            },
        }
    })
</script>
</body>

<style>
    /*semantic-ui注释覆盖需要加important*/

    /*用于调整导航上下边距*/
    .m-padding-up-dowm-min{
        padding-top: 0.2em !important;
        padding-bottom: 0.2em !important;
    }

    /*用于调整footer的上下边距*/
    .m-footer-padding-up-dowm-min{
        padding-top: 5em !important;
        padding-bottom: 5em !important;
    }

    /*在一行内显示*/
    .m-inline-block{
        display: inline-block !important;
    }
</style>
</html>